package com.wangdao.wechatmall.controller.admin;

import com.wangdao.wechatmall.bean.bo.admin.LogParamBO;
import com.wangdao.wechatmall.bean.vo.admin.BaseRespVo;
import com.wangdao.wechatmall.bean.vo.admin.LogDataVO;
import com.wangdao.wechatmall.service.admin.LogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName: LogController
 * @Description ${DESCRIPTION}
 * @Author Xinhao Yi
 * @Date 2021/7/9  16:37
 */
@RestController
@RequestMapping("admin/log")
public class LogController {

    @Autowired
    LogService logService;

    //请求 URL: http://localhost:8083/admin/log/list?page=1&limit=20&sort=add_time&order=desc
    //http://182.92.235.201:8083/admin/log/list?page=1&limit=20&name=admin&sort=add_time&order=desc
    //请求负载：page=1&limit=20&sort=add_time&order=desc
    //响应负载：{"errno":0,"data":{"total":986,"items":[{"id":985,"admin":"admin123","ip":"111.172.194.156","type":1,"action":"登录","status":true,"result":"","comment":"","addTime":"2021-07-09 16:41:14","updateTime":"2021-07-09 16:41:14","deleted":false}]},"errmsg":"成功"}
    /**
     * 查找日志
     * @param param
     * @return
     */
    @RequestMapping("list")
    public BaseRespVo list(LogParamBO param){
        LogDataVO logVOList = logService.queryLogs(param);
        return BaseRespVo.ok(logVOList);
    }

}
